package com.zhangzhenwei.demo.controller;
import com.zhangzhenwei.demo.service.TestService;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zhangzhenwei.demo.domain.Test;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
public class testcontroller {
    @Value("${test.hello:TEST}")
    private String testhello;

    @GetMapping("/hello")
    public String hello() {
        return "hello world!" + testhello;
    }

    @PostMapping("/hello/post")
    public String helloPost(String name) {
        return "hello world!post," + name;
    }
    @Resource
    private TestService testService;
    @GetMapping("/test/list")
    public List<Test>list(){
        return testService.list();
    }
}

